package com.web.controller;

import com.web.annotation.SecurityParameter;
import com.web.annotation.User;
import com.web.util.resultUtil.ResultModel;
import com.web.util.resultUtil.ResultTools;
import lombok.extern.slf4j.Slf4j;
import net.sf.json.JSON;
import net.sf.json.JSONObject;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.time.LocalDate;
import java.util.HashMap;
import java.util.Map;

/**
 * @author : Mr.Yan
 * @program : com
 * @create : 2019-03-27 17:58
 * @description :
 */
@Slf4j
@RestController
public class LoginController {


    @SecurityParameter(inDecode = true,outEncode = false)//结果不需要加密则注释
    @RequestMapping("/login")
    public ResultModel login(@RequestBody @Validated User user){
        log.info("进入login后台");
        log.info("登录用户："+user.toString());

        Map<String,Object> resultMap =  new HashMap<>();
        resultMap.put("userid","200");
        return ResultTools.result(0,"",resultMap);
    }

    public static void main(String[] args) {
        LocalDate now = LocalDate.now();
        System.out.println("今年："+now.toString());
        LocalDate localDate = now.plusYears(10);
        System.out.println("一年后："+localDate);
    }
}
